<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>我爱科技论坛-VIP视频免费看</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link rel="stylesheet" href="css/base.css">
    <link rel="stylesheet" href="css/index.css">
</head>

<body>

<!--site-nav start, 这里使用清除浮动的方式让这个盒子具有高度-->
<div class="site-nav clearfix">
    <div class="w">
        <div class="site-nav-logo">
            <a href="#" class="logo"><img src="images/logo.png" alt="">VIP电影</a>
        </div>
        <div class="site-nav-search">
            <form action="" method="get">
                <input type="text" placeholder="请输入电影名称">
                <button type="submit">搜索</button>
            </form>
        </div>
        <div class="site-nav-r">
            <ul>
                <li><a href="index.html">电影</a></li>
                <li><a href="login.html">登录</a></li>
                <li><a href="register.html">注册</a></li>
                <li><a href="index.html">退出</a></li>
                <li><a href="user.html">会员</a></li>
            </ul>
        </div>
    </div>
</div>
<!--site-nav end-->

<!--main start-->
<div class="main">
    <div class="w">
        <div class="main-slider">
            <ul>
                <li class="first"></li>
                <li class="current"><a href="#"><span class="current-title">我爱科技论坛</span><span class="current-content">VIP视频免费看！</span></a>
                </li>
                <li><a href="play.html"><span>我爱科技论坛</span><span>VIP视频免费看！</span></a></li>
                <li><a href="play.html"><span>我爱科技论坛</span><span>VIP视频免费看！</span></a></li>
                <li><a href="play.html"><span>我爱科技论坛</span><span>VIP视频免费看！</span></a></li>
                <li><a href="play.html"><span>我爱科技论坛</span><span>VIP视频免费看！</span></a></li>
                <li><a href="play.html"><span>我爱科技论坛</span><span>VIP视频免费看！</span></a></li>
                <li><a href="play.html"><span>我爱科技论坛</span><span>VIP视频免费看！</span></a></li>
                <li><a href="play.html"><span>我爱科技论坛</span><span>VIP视频免费看！</span></a></li>
                <li class="last"></li>
            </ul>
            <!--这是一个空盒子-->
            <a href="javascript:void(0);" class="arrow-l"><</a>
            <a href="javascript:void(0);" class="arrow-r">></a>
        </div>
    </div>
</div>
<!--main end-->

<!--movies start-->
<div class="movies clearfix">
    <div class="w">
        <!--电影类型-->
        <div class="movies-type">
            <h1>影视推荐</h1>
            <ul>
                <li id="movie">电影</li>
                <li id="tv">电视剧</li>
                <li id="tvshow">综艺</li>
                <li id="anime">动漫</li>
            </ul>
        </div>
        <!--电影节目-->
        <div class="movies-content">
            <ul>
                <li>
                    <div class="movies-img" href="#"><img src="" alt="">262*166 电影节目</div>
                    <div class="movies-info">
                        <span class="movie-name">环太平洋</span>
                        <span class="movie-index">★&nbsp;★&nbsp;★&nbsp;★&nbsp;☆&nbsp;</span>
                    </div>
                    <a class="movies-play" href="play.html">
                        ▶&nbsp;播放
                    </a>
                </li>
                <li>
                    <div class="movies-img" href="#"><img src="" alt="">262*166 电影节目</div>
                    <div class="movies-info">
                        <span class="movie-name">环太平洋</span>
                        <span class="movie-index">★&nbsp;★&nbsp;★&nbsp;★&nbsp;☆&nbsp;</span>
                    </div>
                    <a class="movies-play" href="play.html">
                        ▶&nbsp;播放
                    </a>
                </li>
                <li>
                    <div class="movies-img" href="#"><img src="" alt="">262*166 电影节目</div>
                    <div class="movies-info">
                        <span class="movie-name">环太平洋</span>
                        <span class="movie-index">★&nbsp;★&nbsp;★&nbsp;★&nbsp;☆&nbsp;</span>
                    </div>
                    <a class="movies-play" href="play.html">
                        ▶&nbsp;播放
                    </a>
                </li>
                <li>
                    <div class="movies-img" href="#"><img src="" alt="">262*166 电影节目</div>
                    <div class="movies-info">
                        <span class="movie-name">环太平洋</span>
                        <span class="movie-index">★&nbsp;★&nbsp;★&nbsp;★&nbsp;☆&nbsp;</span>
                    </div>
                    <a class="movies-play" href="play.html">
                        ▶&nbsp;播放
                    </a>
                </li>
                <li>
                    <div class="movies-img" href="#"><img src="" alt="">262*166 电影节目</div>
                    <div class="movies-info">
                        <span class="movie-name">环太平洋</span>
                        <span class="movie-index">★&nbsp;★&nbsp;★&nbsp;★&nbsp;☆&nbsp;</span>
                    </div>
                    <a class="movies-play" href="play.html">
                        ▶&nbsp;播放
                    </a>
                </li>
                <li>
                    <div class="movies-img" href="#"><img src="" alt="">262*166 电影节目</div>
                    <div class="movies-info">
                        <span class="movie-name">环太平洋</span>
                        <span class="movie-index">★&nbsp;★&nbsp;★&nbsp;★&nbsp;☆&nbsp;</span>
                    </div>
                    <a class="movies-play" href="play.html">
                        ▶&nbsp;播放
                    </a>
                </li>
                <li>
                    <div class="movies-img" href="#"><img src="" alt="">262*166 电影节目</div>
                    <div class="movies-info">
                        <span class="movie-name">环太平洋</span>
                        <span class="movie-index">★&nbsp;★&nbsp;★&nbsp;★&nbsp;☆&nbsp;</span>
                    </div>
                    <a class="movies-play" href="play.html">
                        ▶&nbsp;播放
                    </a>
                </li>
                <li>
                    <div class="movies-img" href="#"><img src="" alt="">262*166 电影节目</div>
                    <div class="movies-info">
                        <span class="movie-name">环太平洋</span>
                        <span class="movie-index">★&nbsp;★&nbsp;★&nbsp;★&nbsp;☆&nbsp;</span>
                    </div>
                    <a class="movies-play" href="play.html">
                        ▶&nbsp;播放
                    </a>
                </li>
                <li>
                    <div class="movies-img" href="#"><img src="" alt="">262*166 电影节目</div>
                    <div class="movies-info">
                        <span class="movie-name">环太平洋</span>
                        <span class="movie-index">★&nbsp;★&nbsp;★&nbsp;★&nbsp;☆&nbsp;</span>
                    </div>
                    <a class="movies-play" href="play.html">
                        ▶&nbsp;播放
                    </a>
                </li>
                <li>
                    <div class="movies-img" href="#"><img src="" alt="">262*166 电影节目</div>
                    <div class="movies-info">
                        <span class="movie-name">环太平洋</span>
                        <span class="movie-index">★&nbsp;★&nbsp;★&nbsp;★&nbsp;☆&nbsp;</span>
                    </div>
                    <a class="movies-play" href="play.html">
                        ▶&nbsp;播放
                    </a>
                </li>
                <li>
                    <div class="movies-img" href="#"><img src="" alt="">262*166 电影节目</div>
                    <div class="movies-info">
                        <span class="movie-name">环太平洋</span>
                        <span class="movie-index">★&nbsp;★&nbsp;★&nbsp;★&nbsp;☆&nbsp;</span>
                    </div>
                    <a class="movies-play" href="play.html">
                        ▶&nbsp;播放
                    </a>
                </li>
                <li>
                    <div class="movies-img" href="#"><img src="" alt="">262*166 电影节目</div>
                    <div class="movies-info">
                        <span class="movie-name">环太平洋</span>
                        <span class="movie-index">★&nbsp;★&nbsp;★&nbsp;★&nbsp;☆&nbsp;</span>
                    </div>
                    <a class="movies-play" href="play.html">
                        ▶&nbsp;播放
                    </a>
                </li>
                <li>
                    <div class="movies-img" href="#"><img src="" alt="">262*166 电影节目</div>
                    <div class="movies-info">
                        <span class="movie-name">环太平洋</span>
                        <span class="movie-index">★&nbsp;★&nbsp;★&nbsp;★&nbsp;☆&nbsp;</span>
                    </div>
                    <a class="movies-play" href="play.html">
                        ▶&nbsp;播放
                    </a>
                </li>
                <li>
                    <div class="movies-img" href="#"><img src="" alt="">262*166 电影节目</div>
                    <div class="movies-info">
                        <span class="movie-name">环太平洋</span>
                        <span class="movie-index">★&nbsp;★&nbsp;★&nbsp;★&nbsp;☆&nbsp;</span>
                    </div>
                    <a class="movies-play" href="play.html">
                        ▶&nbsp;播放
                    </a>
                </li>
                <li>
                    <div class="movies-img" href="#"><img src="" alt="">262*166 电影节目</div>
                    <div class="movies-info">
                        <span class="movie-name">环太平洋</span>
                        <span class="movie-index">★&nbsp;★&nbsp;★&nbsp;★&nbsp;☆&nbsp;</span>
                    </div>
                    <a class="movies-play" href="play.html">
                        ▶&nbsp;播放
                    </a>
                </li>
                <li>
                    <div class="movies-img" href="#"><img src="" alt="">262*166 电影节目</div>
                    <div class="movies-info">
                        <span class="movie-name">环太平洋</span>
                        <span class="movie-index">★&nbsp;★&nbsp;★&nbsp;★&nbsp;☆&nbsp;</span>
                    </div>
                    <a class="movies-play" href="play.html">
                        ▶&nbsp;播放
                    </a>
                </li>

            </ul>
        </div>
        <!--电视节目-->
        <div class="tvs-content">
            <ul>
                <li>
                    <div class="movies-img" href="#"><img src="" alt="">262*166 电视节目</div>
                    <div class="movies-info">
                        <span class="movie-name">环太平洋</span>
                        <span class="movie-index">★&nbsp;★&nbsp;★&nbsp;★&nbsp;☆&nbsp;</span>
                    </div>
                    <a class="movies-play" href="play.html">
                        ▶&nbsp;播放
                    </a>
                </li>
                <li>
                    <div class="movies-img" href="#"><img src="" alt="">262*166 电视节目</div>
                    <div class="movies-info">
                        <span class="movie-name">环太平洋</span>
                        <span class="movie-index">★&nbsp;★&nbsp;★&nbsp;★&nbsp;☆&nbsp;</span>
                    </div>
                    <a class="movies-play" href="play.html">
                        ▶&nbsp;播放
                    </a>
                </li>
                <li>
                    <div class="movies-img" href="#"><img src="" alt="">262*166 电视节目</div>
                    <div class="movies-info">
                        <span class="movie-name">环太平洋</span>
                        <span class="movie-index">★&nbsp;★&nbsp;★&nbsp;★&nbsp;☆&nbsp;</span>
                    </div>
                    <a class="movies-play" href="play.html">
                        ▶&nbsp;播放
                    </a>
                </li>
            </ul>
        </div>
        <!--综艺节目-->
        <div class="tvshows-content">
            <ul>
                <li>
                    <div class="movies-img" href="#"><img src="" alt="">262*166 综艺节目</div>
                    <div class="movies-info">
                        <span class="movie-name">环太平洋</span>
                        <span class="movie-index">★&nbsp;★&nbsp;★&nbsp;★&nbsp;☆&nbsp;</span>
                    </div>
                    <a class="movies-play" href="play.html">
                        ▶&nbsp;播放
                    </a>
                </li>
                <li>
                    <div class="movies-img" href="#"><img src="" alt="">262*166 综艺节目</div>
                    <div class="movies-info">
                        <span class="movie-name">环太平洋</span>
                        <span class="movie-index">★&nbsp;★&nbsp;★&nbsp;★&nbsp;☆&nbsp;</span>
                    </div>
                    <a class="movies-play" href="play.html">
                        ▶&nbsp;播放
                    </a>
                </li>
                <li>
                    <div class="movies-img" href="#"><img src="" alt="">262*166 综艺节目</div>
                    <div class="movies-info">
                        <span class="movie-name">环太平洋</span>
                        <span class="movie-index">★&nbsp;★&nbsp;★&nbsp;★&nbsp;☆&nbsp;</span>
                    </div>
                    <a class="movies-play" href="play.html">
                        ▶&nbsp;播放
                    </a>
                </li>
            </ul>
        </div>
        <!--动漫节目-->
        <div class="animes-content">
            <ul>
                <li>
                    <div class="movies-img" href="#"><img src="" alt="">262*166 动漫节目</div>
                    <div class="movies-info">
                        <span class="movie-name">环太平洋</span>
                        <span class="movie-index">★&nbsp;★&nbsp;★&nbsp;★&nbsp;☆&nbsp;</span>
                    </div>
                    <a class="movies-play" href="play.html">
                        ▶&nbsp;播放
                    </a>
                </li>
                <li>
                    <div class="movies-img" href="#"><img src="" alt="">262*166 动漫节目</div>
                    <div class="movies-info">
                        <span class="movie-name">环太平洋</span>
                        <span class="movie-index">★&nbsp;★&nbsp;★&nbsp;★&nbsp;☆&nbsp;</span>
                    </div>
                    <a class="movies-play" href="play.html">
                        ▶&nbsp;播放
                    </a>
                </li>
                <li>
                    <div class="movies-img" href="#"><img src="" alt="">262*166 动漫节目</div>
                    <div class="movies-info">
                        <span class="movie-name">环太平洋</span>
                        <span class="movie-index">★&nbsp;★&nbsp;★&nbsp;★&nbsp;☆&nbsp;</span>
                    </div>
                    <a class="movies-play" href="play.html">
                        ▶&nbsp;播放
                    </a>
                </li>
            </ul>
        </div>
        <!--电影分页-->
        <div class="movies-page">
            <div class="w">
                <ul>
                    <li><a class="page-btn" href="#">首页</a></li>
                    <li><a class="page-btn" href="#">上一页</a></li>
                    <li><a class="page-btn" href="#">1&nbsp;/&nbsp;10</a></li>
                    <li><a class="page-btn" href="#">下一页</a></li>
                    <li><a class="page-btn" href="#">尾页</a></li>
                </ul>
            </div>

        </div>
    </div>
</div>
<!--movies end-->

<!--footer start-->
<div class="footer clearfix">
    <div class="w">
        <div class="footer-links">
            <dl>
                <!--注意dl下面有dt和dd两个级别，别搞混了-->
                <dt><a href="#">关于我们</a></dt>
                <dd><a href="#">联系我们</a></dd>
                <dd><a href="#">网站地图</a></dd>
                <dd><a href="#">常见问题</a></dd>
                <dd><a href="#">投稿须知</a></dd>
            </dl>
            <dl>
                <!--注意dl下面有dt和dd两个级别，别搞混了-->
                <dt><a href="#">联系我们</a></dt>
                <dd><a href="#">邮箱</a></dd>
                <dd><a href="#">微博</a></dd>
                <dd><a href="#">QQ群</a></dd>
                <dd><a href="#">微信</a></dd>
            </dl>
            <dl>
                <!--注意dl下面有dt和dd两个级别，别搞混了-->
                <dt><a href="#">网站服务</a></dt>
                <dd><a href="#">创业报道</a></dd>
                <dd><a href="#">广告支持</a></dd>
                <dd><a href="#">网站推广</a></dd>
                <dd><a href="#">商务合作</a></dd>
            </dl>
            <dl>
                <!--注意dl下面有dt和dd两个级别，别搞混了-->
                <dt><a href="#">帮助中心</a></dt>
                <dd><a href="#">登陆注册</a></dd>
                <dd><a href="#">找回密码</a></dd>
                <dd><a href="#">自助服务</a></dd>
                <dd><a href="#">资源下载</a></dd>
            </dl>
            <dl class="last" id="lastlogo">
                <dt><a href="#">关注我们</a></dt>
                <dd><a href="#">微信</a></dd>
                <dd><a href="#">QQ群</a></dd>
                <dd><a href="#">新浪</a></dd>
                <dd><a href="#">邮箱</a></dd>
                <div class="img-show" id="imgshow">
                    <img src="images/weixin.jpg" alt="">
                </div>
            </dl>

        </div>
    </div>
</div>
<!--footer end-->

<script src="js/xframe-min-1.0.js" type="text/javascript"></script>
<script src="js/base.js" type="text/javascript"></script>
<script>
    //首页轮播图效果开始------------------------------------------------------------------------------------------
    /**
     * 使用面向对象的方式封装这个轮播图效果
     */
    function imgShow() {
    }

    /**
     * 首页的电影效果轮播图效果实现
     * @type {{imgs: Array, num: number, currentNumber: number, elements: null, start: imgShow.start, init: imgShow.init, initParas: imgShow.initParas, initEvent: imgShow.initEvent, itemMove: imgShow.itemMove, mouseover: imgShow.mouseover, click: imgShow.click, autoPlay: imgShow.autoPlay}}
     */
    imgShow.prototype = {
        imgs : [],         // 图片数组
        num : -1,           // 初始的图片下标
        currentNumber : 0,     // 当前展示的图片下表编号
        elements : null,        // 存储获取的DOM元素

        /**
         * 输入图片路径信息之后， 开启轮播图效果
         * @param imgs
         */
        start : function (imgs) {
            this.init(imgs);
        },
        /**
         * 输入参数初始化
         * 事件处理模块初始化
         * @param imgs
         */
        init : function (imgs) {
            // 初始化输入参数
            this.initParas(imgs);
            // 主程序入口
            this.autoPlay();
            // 事件初始化
            this.initEvent();
        },
        /**
         * 输入参数初始化
         * @param imgs
         */
        initParas : function (imgs) {
            this.imgs = imgs;
            this.elements = $('.main-slider ul li');
            // 初始化图片背景
            $('.main-slider').css('background', 'url(' + this.imgs[0] + ')').css('background-size', '100%');
            // IE  兼容
            $('.main-slider').css('filter', 'progid:DXImageTransform.Microsoft.AlphaImageLoader(' + 'src=' + this.imgs[0] + ',sizingMethod="scale")');
        },
        /**
         * 事件处理初始化
         */
        initEvent : function () {
            this.mouseover();
            this.click();
        },
        /**
         * 自动移动项的实现（图片随项一起移动）
         * @param index
         */
        itemMove : function (index) {
            // 移动之后，找到相应的li-item，改变他的样式
            var lis = $('.main-slider ul li');
            lis.each(function () {
                var a = this.childNodes[0];
                if (this.className === 'current') {
                    this.className = '';
                    a.childNodes[0].className = '';
                    a.childNodes[1].className = '';
                }
            });

            // 把当前的设置为样式 index = 0, 则切换为第0个li标签
            var current = lis[index+1];
            current.className = 'current';
            current.childNodes[0].childNodes[0].className = 'current-title';
            current.childNodes[0].childNodes[1].className = 'current-content';
        },
        /**
         * 鼠标移动事件处理模块
         */
        mouseover : function () {
            // 获取所有的li标签
            var lis = this.elements;
            var self = this;
            lis.on('mouseover', function () {
                if (this.className === 'first' || this.className === 'last'){
                    return;
                }
                lis.each(function () {
                    var a = this.childNodes[0];
                    if (this.className === 'current') {
                        this.className = '';
                        a.childNodes[0].className = '';
                        a.childNodes[1].className = '';
                    }
                });
                // 把当前的设置为样式
                var current = this.childNodes[0];
                this.className = 'current';
                current.childNodes[0].className = 'current-title';
                current.childNodes[1].className = 'current-content';
                //  原始的实现可以通过父节点的所有孩子节点变遍历的方式来判断，srcNode.parentNode.childNodes[index] === srcNode
                // console.log($(this).index())
                // 设置完毕之后， 修改与之相对应的图片样式信息
                $('.main-slider').css('background', 'url(' + self.imgs[$(this).index()-1] + ')').css('background-size', '100%');
            });
        },
        /**
         * 鼠标单击事件处理模块
         */
        click : function () {
            var self = this;
            $('.arrow-l').on('click', function () {
                self.currentNumber--;
                if (self.currentNumber<0){
                    self.currentNumber = self.imgs.length-1;
                }
                $('.main-slider').css('background', 'url(' + self.imgs[self.currentNumber] + ')').css('background-size', '100%');

                // 设置为自动移动标签项
                self.itemMove(self.currentNumber);
                self.num = self.currentNumber;
            });

            $('.arrow-r').on('click', function () {
                self.currentNumber++;
                if (self.currentNumber > self.imgs.length-1){
                    self.currentNumber = 0;
                }
                $('.main-slider').css('background', 'url(' + self.imgs[self.currentNumber] + ')').css('background-size', '100%');

                // 设置为自动移动
                self.itemMove(self.currentNumber);
                self.num = self.currentNumber;
            });

        },
        /***
         * 轮播图自动播放的实现
         */
        autoPlay : function () {
            var self = this;
            setInterval(function () {
                self.num++;
                $('.main-slider').css('background', 'url(' + self.imgs[self.num % 8] + ')').css('background-size', '100%');
                self.currentNumber = self.num % 8;

                // 开始移动item项
                self.itemMove(self.currentNumber);
            }, 4000);
        },
    }


    /**
     * 轮播图效果的启动
     * @param ev
     */
    window.onload = function () {
        // 图片数组初始化
        var imgs = [
            'images/big0.jpg',
            'images/big1.jpg',
            'images/big2.jpg',
            'images/big3.jpg',
            'images/big4.jpg',
            'images/big5.jpg',
            'images/big6.jpg',
            'images/big7.jpg',
        ];

        // 初始化参数，启动轮播图效果
        var run = new imgShow(imgs);
        run.start(imgs);

        // 启动切换菜单
        toggleMovieButton();

        // 底部菜单
        toggleLogo();
    }
    //首页轮播图效果结束------------------------------------------------------------------------------------------


    //首页电影切换菜单开始------------------------------------------------------------------------------------------
    function toggleMovieButton() {
        $('.movies-type ul li').on('click', function () {
            // 先把其他的颜色都恢复
            var lis = $('.movies-type ul li');
            lis.each(function () {
                $(this).css('backgroundColor', '#ff8b20');
                if ($(this).hasClass('current-click')){
                    // this.className = '';
                    $(this).removeClass('current-click');
                }
            });
            // 获取标签里面的文本内容
            var text = $(this).text();
            // 改变当前的按钮颜色
            $(this).css('backgroundColor', '#ffbd23');
            if (!$(this).hasClass('current-click')){
                $(this).addClass('current-click');
            }
            switch (text){
                case '电影':
                    $('.movies-content').show();
                    $('.tvs-content').hide();
                    $('.tvshows-content').hide();
                    $('.animes-content').hide();
                    break;
                case '电视剧':
                    $('.movies-content').hide();
                    $('.tvs-content').show();
                    $('.tvshows-content').hide();
                    $('.animes-content').hide();
                    break;
                case '综艺':
                    $('.movies-content').hide();
                    $('.tvs-content').hide();
                    $('.tvshows-content').show();
                    $('.animes-content').hide();
                    break;
                case '动漫':
                    $('.movies-content').hide();
                    $('.tvs-content').hide();
                    $('.tvshows-content').hide();
                    $('.animes-content').show();
                    break;
            }
        }).on('mouseover', function () {
            $(this).css('backgroundColor', '#ffa203');
        }).on('mouseout', function () {
            // 把当前没有点击的，颜色恢复
            if (!$(this).hasClass('current-click')){
                $(this).css('backgroundColor', '#ff8b20');
            }
        });
    }
    //首页电影切换菜单结束------------------------------------------------------------------------------------------

</script>
</body>
</html>
